#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@File    :   5.py
@Time    :   2020/04/24 15:52:35
@Author  :   Malygos_l 
@Version :   1.0
@Contact :   751756061@qq.com
@WebSite :   www.gitee.com/malygos_l
'''
# 文件编程小项目
# Start typing your code from here

try:
    with open ('homework3\Blowing in the wind.txt','r+') as f:
        line = f.readlines()
        line = list(line)
        line.insert(0,'Blowin\' in the wind\nBob Dylan\n')
        line.append("\n1962 by Warner Bros.Inc")
        # f.seek(0,0)
        # f.write(0,'Blowin\' in the wind\nBob Dylan\n')
        # f.seek(0,2)
        # f.write('\n1962 by Warner Bros.Inc')
        f.seek(0)
        for i in line:
            f.write(i)
            print(i)
        # for line in f.readlines():
        #     print('%s' % line)
except IOError:
    print('ERROR!')    
